
import http from "@/utils/ajax/http"
import { extend } from "@/utils/extend"
import AroundHotels from "./views/hotels/around-hotels.vue";

const api = {
    code: {
        OK: 0
    },
    token: {
        login: 'authLogin.do?ac=login',
        tokenLogin: 'tokenLogin.do',
        logout: 'logout.do'
    },
    checkUpdate: 'sh.do',
    editorPassword: 'editPassword',
    checkField: 'checkno.do',

    payment: 'payment.do',

    favorite: {
        favorite: 'favorite.do',
        listusername: "favorite_list2.do",
        delete: 'favorite_delete'
    },
    captch() {
        var url = "captcha.do?rd=" + Math.floor(Math.random() * 100000);
        return new Promise((resolve, reject) => {
            http.get(url).then(res => {
                var url = res.data;
                resolve(url);
            }, reject);
        });
    },
    search: {
        select: 'selectUpdateSearch.do',
        table: 'tableAjax.do?a=table',
        selectView: 'selectView.do',
        all: 'selectAll.do'
    },
    attachment: {
        uploadUrl: 'upload_re.do',
        upload(file) {
            return new Promise((resolve, reject) => {
                var formdata = new FormData();
                formdata.append("fujian", file, file.name || 'tmp.png');
                http.post(api.attachment.uploadUrl, formdata)
                    .then(res => {
                        if (res.code == api.code.OK) {
                            resolve(res.data);
                        } else {
                            reject(res.msg);
                        }
                    }).catch(err => {
                        reject(err.message);
                    });
            });
        },
    },
    admins: {
        list: "admins_list.do",
        insert: "adminsinsert.do",
        update: "adminsupdate.do",
        delete: "admins_delete.do",
        detail: "admins_detail.do",
        create: "admins_add.do",
        edit: "admins_updt.do",
    },
    sendemail: "sendverificationcode.do",
    user: {
        list: "user_list.do",
        insert: "userinsert.do",
        update: "userupdate.do",
        delete: "user_delete.do",
        detail: "user_detail.do",
        create: "user_add.do",
        edit: "user_updt.do",
    },
    newskind: {
        list: "newskind_list.do",
        insert: "newskindinsert.do",
        update: "newskindupdate.do",
        delete: "newskind_delete.do",
        detail: "newskind_detail.do",
        create: "newskind_add.do",
        edit: "newskind_updt.do",
    },
    news: {
        list: "news_list.do",
        insert: "newsinsert.do",
        update: "newsupdate.do",
        delete: "news_delete.do",
        detail: "news_detail.do",
        create: "news_add.do",
        edit: "news_updt.do",
        listadmin: "news_list_admin.do",
        weblist: "newslist.do",
        webdetail: "newsdetail.do",
    },
    emergencykind: {
        list: "emergencykind_list.do",
        insert: "emergencykindinsert.do",
        update: "emergencykindupdate.do",
        delete: "emergencykind_delete.do",
        detail: "emergencykind_detail.do",
        create: "emergencykind_add.do",
        edit: "emergencykind_updt.do",
    },
    emergency: {
        list: "emergency_list.do",
        insert: "emergencyinsert.do",
        update: "emergencyupdate.do",
        delete: "emergency_delete.do",
        detail: "emergency_detail.do",
        create: "emergency_add.do",
        edit: "emergency_updt.do",
        listadmin: "emergency_list_admin.do",
        weblist: "emergencylist.do",
        webdetail: "emergencydetail.do",
    },
    complaint: {
        list: "complaint_list.do",
        insert: "complaintinsert.do",
        update: "complaintupdate.do",
        delete: "complaint_delete.do",
        detail: "complaint_detail.do",
        create: "complaint_add.do",
        edit: "complaint_updt.do",
        listusername: "complaint_list_username.do",
        complaints_statistics: "complaints_statistics.do"
    },
    carousel: {
        list: "carousel_list.do",
        insert: "carouselinsert.do",
        update: "carouselupdate.do",
        delete: "carousel_delete.do",
        detail: "carousel_detail.do",
        create: "carousel_add.do",
        edit: "carousel_updt.do",
    },
    attraction: {
        list: "attraction_list.do",
        insert: "attractioninsert.do",
        update: "attractionupdate.do",
        delete: "attraction_delete.do",
        detail: "attraction_detail.do",
        create: "attraction_add.do",
        edit: "attraction_updt.do",
        weblist: "attractionlist.do",
        webdetail: "attractiondetail.do",
    },
    attractionkind: {
        list: "attractionkind_list.do",
        insert: "attractionkindinsert.do",
        update: "attractionkindupdate.do",
        delete: "attractionkind_delete.do",
        detail: "attractionkind_detail.do",
        create: "attractionkind_add.do",
        edit: "attractionkind_updt.do",
    },
    strategy: {
        list: "strategy_list.do",
        insert: "strategyinsert.do",
        update: "strategyupdate.do",
        delete: "strategy_delete.do",
        detail: "strategy_detail.do",
        create: "strategy_add.do",
        edit: "strategy_updt.do",
        weblist: "strategylist.do",
        webdetail: "strategydetail.do",
    },
    strategybooking: {
        list: "strategybooking_list.do",
        insert: "strategybookinginsert.do",
        update: "strategybookingupdate.do",
        delete: "strategybooking_delete.do",
        detail: "strategybooking_detail.do",
        create: "strategybooking_add.do",
        edit: "strategybooking_updt.do",
        listusername: "strategybooking_list_username.do",
    },
    food: {
        list: "food_list.do",
        insert: "foodinsert.do",
        update: "foodupdate.do",
        delete: "food_delete.do",
        detail: "food_detail.do",
        create: "food_add.do",
        edit: "food_updt.do",
        weblist: "foodlist.do",
        webdetail: "fooddetail.do",
    },
    foodkind: {
        list: "foodkind_list.do",
        insert: "foodkindinsert.do",
        update: "foodkindupdate.do",
        delete: "foodkind_delete.do",
        detail: "foodkind_detail.do",
        create: "foodkind_add.do",
        edit: "foodkind_updt.do",
    },
    performanceInfo: {
        list: "performanceInfo_list.do",
        insert: "performanceInfoinsert.do",
        update: "performanceInfoupdate.do",
        delete: "performanceInfo_delete.do",
        detail: "performanceInfo_detail.do",
        create: "performanceInfo_add.do",
        edit: "performanceInfo_updt.do",
        weblist: "performanceInfolist.do",
        webdetail: "performanceInfodetail.do",
    },
    performanceType: {
        list: "performancetype_list.do",
        insert: "performancetype_insert.do",
        update: "performancetype_update.do",
        delete: "performancetype_delete.do",
        detail: "performancetype_detail.do",
        create: "performancetype_add.do",
        edit: "performancetype_updt.do",
    },
    searchHotels: {
        aroundHotels: "around_hotels.do",
    },
    hotelbooking: "hotelbooking.do",
    booking: {
        list: "hotelbooking_list.do",
        close_page: "close_page.do",
        bookinglist:"booking_list.do",
        delete:"booking_delete.do",
    },
    recommend: "recommend.do",

}

export default api
